<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>有10个学生的成绩存在数组中，请统计大于等于平均成绩的人数。</title>
</head>
<body>
    <script>
        function bigThanAve (arr) {
            var sum = 0, count = 0;
            for (i = 0 ; i < arr.length ; i++) {
                sum+=arr[i];
            }
            var ave = sum / arr.length;
            console.log(ave);
            for (i = 0 ; i < arr.length ; i++) {
                if (arr[i] >= ave) {
                    count++;
                }
            }
            return count;
        }
        arr = [29, 20, 27, 36, 13,29, 20, 27, 36, 13]
        console.log(bigThanAve(arr));
    </script>
</body>
</html>